﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TsSite.Master" AutoEventWireup="true" CodeBehind="ManageEdiPartners.aspx.cs" Inherits="TireService.Web.View.AdminView.ManageEdiPartners" %>


<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPanel" tagprefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxRoundPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1.Export, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView.Export" TagPrefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <table cellpadding="0" cellspacing="2" border="0">
        <tr>
            <td>
                <img id="imgContainer" alt="" src="~/Images/Medium/cubes_yellow.png" runat="server" style="width: 32px; height: 32px" />
            </td>
            <td valign="middle">
                <h3><asp:Label ID="lblEdiPartnerHeader" runat="server" Text="EDI Partnere"></asp:Label></h3>
            </td>
        </tr>
    </table>
    <hr />

    <!-- Javascript of action dropdown list -->
    <script language="javascript" type="text/javascript">

        // Function that handles actions selected in dropdown list
        function ActionClicked() {

            // Get selected action from dropdownlist
            var id = ddlAction.GetValue();

            if (id != null && id != 0) {
                if (id == 1) {
                    // TODO:
                }

                if (id == 2) {
                    // TODO:

                }

            }
            else {
                alert('Ingen handling valgt');
            }
        }

        
        function CallbackError() {
            alert('Fejl opstod - prøv venligst igen');
        }

    </script>                
                
    <table border="0" cellspacing="0" cellpadding="5" width="100%">
        <tr>
            <td style="width:150px">
                <dxe:ASPxComboBox ID="ddlAction" ClientInstanceName="ddlAction" runat="server" Width="150px">
                    <Items>
                        <dxe:ListEditItem Selected="true" Value="0" Text="-- Handling --" />

                    </Items>
                </dxe:ASPxComboBox>
            </td>
            <td style="width:75px">
                <dxe:ASPxButton ID="btnSubmitAction" runat="server" Text="Udfør" AutoPostBack="False" UseSubmitBehavior="False" Width="75px">
                    <ClientSideEvents Click="function(s, e) { ActionClicked(); }" />
                </dxe:ASPxButton>
            </td>
            <td style="width:150px">
                <dxe:ASPxComboBox ID="ddlExport" ClientInstanceName="ddlExport" runat="server" Width="150px">
                    <Items>
                        <dxe:ListEditItem Selected="True" Value="0" Text="Export pdf" />
                        <dxe:ListEditItem Value="1" Text="Export xls" />
                        <dxe:ListEditItem Value="2" Text="Export csv" />
                        <dxe:ListEditItem Value="3" Text="Export rtf" />
                    </Items>
                </dxe:ASPxComboBox>
            </td>
            <td style="width:75px">
                <dxe:ASPxButton ID="btnExport" runat="server" Text="Exporter" OnClick="btnExport_Click" Width="75px" >
                </dxe:ASPxButton>
            </td>
            <td align="right">
                <asp:Label ID="lblView" runat="server" Text="Visning"></asp:Label>
                <asp:DropDownList ID="ddlView" runat="server" AutoPostBack="True" 
                    onselectedindexchanged="ddlView_SelectedIndexChanged">
                    <asp:ListItem Value="0">Ingen gruppering</asp:ListItem>
                </asp:DropDownList>
                &nbsp;
                <asp:Label ID="lblPageSize" runat="server" Text="Antal linjer pr side"></asp:Label>
                <asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="true">
                    <asp:ListItem Value="10">10</asp:ListItem>
                    <asp:ListItem Value="25">25</asp:ListItem>
                    <asp:ListItem Value="50">50</asp:ListItem>
                    <asp:ListItem Value="100">100</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
    </table>          
    <hr />
           
    <dxwgv:ASPxGridView ID="gvPartnerListEDI" runat="server" ClientInstanceName="gvPartnerListEDI" 
        KeyFieldName="PartnerId" Width="100%" AutoGenerateColumns="False" EnableCallBacks="True" 
        OnRowInserting="gvPartnerListEDI_RowInserting"
        OnRowUpdating="gvPartnerListEDI_RowUpdating">
        <SettingsLoadingPanel Text="Henter&amp;hellip;" />
        <Settings ShowHeaderFilterButton="true" ShowGroupPanel="true" ShowFilterRow="True" />
        <SettingsPager AlwaysShowPager="True" PageSize="20" Position="TopAndBottom">
            <Summary 
                AllPagesText="Sider: {0} - {1} ({2} EDI partnere)" 
                Text="Side {0} af {1} ({2} EDI partnere)" />
        </SettingsPager>
        <SettingsText ConfirmDelete="Vil du slette EDI partner?" GroupPanel="Træk kolonne hertil for at gruppere efter den" HeaderFilterShowAll="Vis alle" />
        <SettingsBehavior ConfirmDelete="True" AllowGroup="true" AllowDragDrop="true" AllowFocusedRow="true" />
        <ClientSideEvents FocusedRowChanged="function(s, e) {
            if (typeof(gvPartnerSubscriptionPrice) != 'undefined')
                gvPartnerSubscriptionPrice.PerformCallback(s.GetFocusedRowIndex());
        }" 
        />
        <Columns>
            <dxwgv:GridViewCommandColumn VisibleIndex="0">
                <EditButton Visible="True" Text="Rediger" />
                <NewButton Visible="True" Text="Opret" />
            </dxwgv:GridViewCommandColumn>
            <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                    <HeaderTemplate>
                        <input type="checkbox" onclick="gvPartnerListEDI.SelectAllRowsOnPage(this.checked);" style="vertical-align:middle;" title="Vælg/Fravælg alle linjer på siden"></input>
                    </HeaderTemplate>
                    <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" 
                        HorizontalAlign="Center">
                    <Paddings PaddingTop="1px" PaddingBottom="1px"></Paddings>
                    </HeaderStyle>
            </dxwgv:GridViewCommandColumn>
            <dxwgv:GridViewDataColumn FieldName="PartnerId" VisibleIndex="2" Caption="PartnerId">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="Name" VisibleIndex="3" Caption="Navn">
                <EditFormSettings VisibleIndex="0" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="XMLInterfaceFileName" Visible="false" VisibleIndex="4" Caption="XML fil">
                <EditFormSettings VisibleIndex="0" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="CustomerId" VisibleIndex="7" Caption="Kundenr">
                <EditFormSettings VisibleIndex="1" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="ActAsParentCustomer" Visible="false" VisibleIndex="8" Caption="Funger som hoved firma">
                <EditFormSettings VisibleIndex="2" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="ParentPayInvoice" Visible="false" VisibleIndex="9" Caption="Betal faktura'er">
                <EditFormSettings VisibleIndex="3" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="IsCompany" Visible="false" VisibleIndex="9" Caption="Firma">
                <EditFormSettings VisibleIndex="3" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="SyncToEconomic" Visible="false" VisibleIndex="9" Caption="Sync. med E-conomic">
                <EditFormSettings VisibleIndex="3" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="ManualInvoicing" Visible="false" VisibleIndex="9" Caption="Manuel fakturering">
                <EditFormSettings VisibleIndex="3" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="InvoicePBS" Visible="false" VisibleIndex="9" Caption="PBS fakturering">
                <EditFormSettings VisibleIndex="3" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="InActive" VisibleIndex="9" Caption="Interface aktivt">
                <EditFormSettings VisibleIndex="3" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="ServerLink" Visible="false" VisibleIndex="9" Caption="Link til FTP-server">
                <EditFormSettings VisibleIndex="3" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="Username" Visible="false" VisibleIndex="9" Caption="Brugernavn">
                <EditFormSettings VisibleIndex="3" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="Password" Visible="false" VisibleIndex="9" Caption="Adgangskode">
                <EditFormSettings VisibleIndex="3" Visible="true" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="Port" Visible="false" VisibleIndex="9" Caption="Portnr">
                <EditFormSettings VisibleIndex="3" Visible="true" />
            </dxwgv:GridViewDataColumn>
        </Columns>
        <SettingsEditing PopupEditFormModal="false" PopupEditFormHorizontalAlign="Center" PopupEditFormAllowResize="false" Mode="PopupEditForm" PopupEditFormWidth="600px" />
        <Templates>
            <EditForm>
                <div style="text-align: left; padding: 2px">
                    <h4>EDI Partner</h4>
                </div>
                <dxwgv:ASPxGridViewTemplateReplacement ID="Editors" ReplacementType="EditFormEditors" runat="server">
                </dxwgv:ASPxGridViewTemplateReplacement>
                <%--<div style="text-align: left; padding: 2px">
                    <% if (gvPartnerListEDI.IsNewRowEditing)
                       { %>
                        Antal lagerpladser:
                        <dxe:ASPxSpinEdit ID="txtAddContainerCargoRooms" runat="server" Height="21px" Number="1" NumberType="Integer" Increment="2">
                            <SpinButtons ShowIncrementButtons="False" ShowLargeIncrementButtons="True" />
                        </dxe:ASPxSpinEdit>
                    <% } %>
                </div>--%>
                <div style="text-align: right; padding: 2px">
                    <dxwgv:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server">
                    </dxwgv:ASPxGridViewTemplateReplacement>
                    <dxwgv:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server">
                    </dxwgv:ASPxGridViewTemplateReplacement>
                </div>
            </EditForm>
        </Templates>            
    </dxwgv:ASPxGridView>
    <hr />
    <dxwgv:ASPxGridView ID="gvPartnerSubscriptionPrice" runat="server" ClientInstanceName="gvPartnerSubscriptionPrice" Width="100%" 
        KeyFieldName="SubscriptionId" AutoGenerateColumns="False" EnableCallBacks="True" 
        oncustomunboundcolumndata="gvPartnerSubscriptionPrice_CustomUnboundColumnData" 
        OnCustomCallback="gvPartnerSubscriptionPrice_CustomCallback"
        OnRowInserting="gvPartnerSubscriptionPrice_RowInserting"
        OnRowUpdating="gvPartnerSubscriptionPrice_RowUpdating">
        <SettingsLoadingPanel Text="Henter&amp;hellip;" />
        <Settings ShowHeaderFilterButton="true" ShowGroupPanel="true" ShowFilterRow="True" />
        <SettingsPager AlwaysShowPager="True" PageSize="20" Position="TopAndBottom">
            <Summary 
                AllPagesText="Sider: {0} - {1} ({2} abonnement priser)" 
                Text="Side {0} af {1} ({2} abonnement priser)" />
        </SettingsPager>
        <SettingsText ConfirmDelete="Vil du slette denne abonnement pris?" />
        <SettingsBehavior ConfirmDelete="True" AllowGroup="true" AllowFocusedRow="true" AllowDragDrop="true" AllowSelectByRowClick="true" />
        <ClientSideEvents Init="function(s, e) {
	        s.PerformCallback(gvPartnerListEDI.GetFocusedRowIndex());
        }" />

        <Columns>
            <dxwgv:GridViewCommandColumn VisibleIndex="0">
                <EditButton Visible="True" Text="Rediger" />
                <NewButton Visible="True" Text="Opret" />
            </dxwgv:GridViewCommandColumn>
            <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                    <HeaderTemplate>
                        <input type="checkbox" onclick="gvPartnerSubscriptionPrice.SelectAllRowsOnPage(this.checked);" style="vertical-align:middle;" title="Vælg/Fravælg alle linjer på siden"></input>
                    </HeaderTemplate>
                    <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" 
                        HorizontalAlign="Center">
                    <Paddings PaddingTop="1px" PaddingBottom="1px"></Paddings>
                    </HeaderStyle>
            </dxwgv:GridViewCommandColumn>
            <dxwgv:GridViewDataColumn FieldName="PartnerId" Visible="false" VisibleIndex="2" Caption="PartnerId">
                <EditFormSettings Visible="False" />
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="SubscriptionId" Visible="false" VisibleIndex="3" Caption="SubscriptionId">
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataColumn FieldName="SubscriptionDescription" UnboundType="String" VisibleIndex="3" Caption="Abonnement">
            </dxwgv:GridViewDataColumn>
            <dxwgv:GridViewDataComboBoxColumn Name="SubscriptionDescriptionDropDown" FieldName="SubscriptionId" Caption="Abonnement" VisibleIndex="10">
                <EditFormSettings VisibleIndex="3" />
            </dxwgv:GridViewDataComboBoxColumn>
            <dxwgv:GridViewDataTextColumn FieldName="Price" VisibleIndex="4" Caption="Pris">
            </dxwgv:GridViewDataTextColumn>
        </Columns>
        <SettingsEditing PopupEditFormModal="false" PopupEditFormHorizontalAlign="Center" PopupEditFormAllowResize="false" Mode="PopupEditForm" PopupEditFormWidth="600px" />
        <%--<Templates>
            <EditForm>
                <div style="text-align: left; padding: 2px">
                    <h4>Abonnement pris</h4>
                </div>
                <dxwgv:ASPxGridViewTemplateReplacement ID="Editors" ReplacementType="EditFormEditors" runat="server">
                </dxwgv:ASPxGridViewTemplateReplacement>
                <div style="text-align: left; padding: 2px">
                    <% if (gvPartnerListEDI.IsNewRowEditing)
                       { %>
                        Antal lagerpladser:
                        <dxe:ASPxSpinEdit ID="txtAddContainerCargoRooms" runat="server" Height="21px" Number="1" NumberType="Integer" Increment="2">
                            <SpinButtons ShowIncrementButtons="False" ShowLargeIncrementButtons="True" />
                        </dxe:ASPxSpinEdit>
                    <% } %>
                </div>
                <div style="text-align: right; padding: 2px">
                    <dxwgv:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server">
                    </dxwgv:ASPxGridViewTemplateReplacement>
                    <dxwgv:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server">
                    </dxwgv:ASPxGridViewTemplateReplacement>
                </div>
            </EditForm>
        </Templates>--%>                                             
    </dxwgv:ASPxGridView>

                                
    <dxwgv:ASPxGridViewExporter ID="gvExport" runat="server" GridViewID="gvPartnerListEDI">
    </dxwgv:ASPxGridViewExporter>

</asp:Content>
